//类型断言  转化成一个更具体的类型
const el = document.getElementById('why') as HTMLImageElement


// HTML  --> HTMLImage  el.src才不会报错
el.src = ""


// eg:2
class Person {

}

class Student extends Person {
  studying() {

  }
}

function say(p:Person) {
  // p.studying   报错  类型是Person
  (p as Student).studying    //类型断言为学生
}

let student = new Student()

say(student)   //不会报错


//eg3

const message = "hello the world"
// const num:number = (message as any) as number   不推荐